AmCharts.AmFunnelChart=AmCharts.Class({inherits:AmCharts.AmSlicedChart,construct:function(t){this.type="funnel";AmCharts.AmFunnelChart.base.construct.call(this,t);this.cname="AmFunnelChart";this.startX=this.startY=0;this.baseWidth="100%";this.neckHeight=this.neckWidth=0;this.rotate=!1;this.valueRepresents="height";this.pullDistance=30;this.labelPosition="center";this.labelText="[[title]]: [[value]]";this.balloonText="[[title]]: [[value]]\n[[description]]";AmCharts.applyTheme(this,t,this.cname)},drawChart:function(){AmCharts.AmFunnelChart.base.drawChart.call(this);var t=this.chartData;if(AmCharts.ifArray(t))if(0<this.realWidth&&0<this.realHeight){var a=Math.round(this.depth3D*Math.cos(this.angle*Math.PI/180)),h=Math.round(-this.depth3D*Math.sin(this.angle*Math.PI/180)),s=this.container,i=this.startDuration,e=this.rotate,r=this.updateWidth();this.realWidth=r;var n=this.updateHeight();this.realHeight=n;var o=AmCharts.toCoordinate,l=o(this.marginLeft,r),d=o(this.marginRight,r),u=o(this.marginTop,n)+this.getTitleHeight(),o=o(this.marginBottom,n);0<a&&0>h&&(this.neckHeight=this.neckWidth=0,e?o-=h/2:u-=h/2);var d=r-l-d,m=AmCharts.toCoordinate(this.baseWidth,d),C=AmCharts.toCoordinate(this.neckWidth,d),c=n-o-u,p=AmCharts.toCoordinate(this.neckHeight,c),A=u+c-p;e&&(u=n-o,A=u-c+p);this.firstSliceY=u;AmCharts.VML&&(this.startAlpha=1);for(var g=d/2+l,f=(c-p)/((m-C)/2),b=1,M=m/2,m=(c-p)*(m+C)/2+C*p,v=u,y=0,p=0;p<t.length;p++){var N=t[p],L;if(!0!==N.hidden){var w=[],x=[],R;if("height"==this.valueRepresents)R=c*N.percents/100;else{var T=-m*N.percents/100/2,k=M;L=-1/(2*f);R=Math.pow(k,2)-4*L*T;0>R&&(R=0);R=(Math.sqrt(R)-k)/(2*L);if(!e&&u>=A||e&&u<=A)R=2*-T/C;else if(!e&&u+R>A||e&&u-R<A)L=e?Math.round(R+(u-R-A)):Math.round(R-(u+R-A)),R=L/f,R=L+2*(-T-(k-R/2)*L)/C}T=M-R/f;k=!1;!e&&u+R>A||e&&u-R<A?(T=C/2,w.push(g-M,g+M,g+T,g+T,g-T,g-T),e?(L=R+(u-R-A),u<A&&(L=0),x.push(u,u,u-L,u-R,u-R,u-L,u)):(L=R-(u+R-A),u>A&&(L=0),x.push(u,u,u+L,u+R,u+R,u+L,u)),k=!0):(w.push(g-M,g+M,g+T,g-T),e?x.push(u,u,u-R,u-R):x.push(u,u,u+R,u+R));s.set();L=s.set();0<a&&0>h?(x=T/M,w=-1,e||(w=1),isNaN(b)&&(b=0),w=new AmCharts.Cuboid(s,2*M,w*R,a,h*b,N.color,N.alpha,this.outlineThickness,this.outlineColor,this.outlineAlpha,90,0,!1,0,N.pattern,x).set,w.translate(g-M,u-h/2*b),b*=x):w=AmCharts.polygon(s,w,x,N.color,N.alpha,this.outlineThickness,this.outlineColor,this.outlineAlpha);AmCharts.setCN(this,L,"funnel-item");AmCharts.setCN(this,w,"funnel-slice");AmCharts.setCN(this,L,N.className,!0);L.push(w);this.graphsSet.push(L);e||L.toBack();N.wedge=L;N.index=p;if(x=this.gradientRatio){var H=[],W;for(W=0;W<x.length;W++)H.push(AmCharts.adjustLuminosity(N.color,x[W]));0<H.length&&w.gradient("linearGradient",H);N.pattern&&w.pattern(N.pattern)}0<i&&(this.chartCreated||L.setAttr("opacity",this.startAlpha));this.addEventListeners(L,N);N.ty0=u-R/2;if(this.labelsEnabled&&this.labelText&&N.percents>=this.hideLabelsPercent){H=this.formatString(this.labelText,N);(w=this.labelFunction)&&(H=w(N,H));W=N.labelColor;W||(W=this.color);var x=this.labelPosition,B="left";"center"==x&&(B="middle");"left"==x&&(B="right");w=void 0;""!=H&&(w=AmCharts.wrappedText(s,H,W,this.fontFamily,this.fontSize,B,!1,this.maxLabelWidth),AmCharts.setCN(this,w,"funnel-label"),AmCharts.setCN(this,w,N.className,!0),w.node.style.pointerEvents="none",L.push(w),H=g,e?(W=u-R/2,N.ty0=W):(W=u+R/2,N.ty0=W,W<v+y+5&&(W=v+y+5),W>n-o&&(W=n-o)),"right"==x&&(H=d+10+l,N.tx0=g+(M-R/2/f),k&&(N.tx0=g+T)),"left"==x&&(N.tx0=g-(M-R/2/f),k&&(N.tx0=g-T),H=l),N.label=w,N.labelX=H,N.labelY=W,N.labelHeight=w.getBBox().height,w.translate(H,W),M=w.getBBox(),v=AmCharts.rect(s,M.width+5,M.height+5,"#ffffff",.005),v.translate(H+M.x,W+M.y),L.push(v),N.hitRect=v,y=w.getBBox().height,v=W)}(0===N.alpha||0<i&&!this.chartCreated)&&L.hide();u=e?u-R:u+R;M=T;N.startX=AmCharts.toCoordinate(this.startX,r);N.startY=AmCharts.toCoordinate(this.startY,n);N.pullX=AmCharts.toCoordinate(this.pullDistance,r);N.pullY=0;N.balloonX=g;N.balloonY=N.ty0}}this.arrangeLabels();this.initialStart();(t=this.legend)&&t.invalidateSize()}else this.cleanChart();this.dispDUpd();this.chartCreated=!0},arrangeLabels:function(){var t=this.rotate,a;a=t?0:this.realHeight;for(var h=0,s=this.chartData,i=s.length,e,r=0;r<i;r++){e=s[i-r-1];var n=e.label,o=e.labelY,l=e.labelX,d=e.labelHeight,u=o;t?a+h+5>o&&(u=a+h+5):o+d+5>a&&(u=a-5-d);a=u;h=d;if(n){n.translate(l,u);var m=n.getBBox()}e.hitRect&&e.hitRect.translate(l+m.x,u+m.y);e.labelY=u;e.tx=l;e.ty=u;e.tx2=l}"center"!=this.labelPosition&&this.drawTicks()}});AmCharts.Cuboid=AmCharts.Class({construct:function(t,a,h,s,i,e,r,n,o,l,d,u,m,C,c,p,A){this.set=t.set();this.container=t;this.h=Math.round(h);this.w=Math.round(a);this.dx=s;this.dy=i;this.colors=e;this.alpha=r;this.bwidth=n;this.bcolor=o;this.balpha=l;this.dashLength=C;this.topRadius=p;this.pattern=c;this.rotate=m;this.bcn=A;m?0>a&&0===d&&(d=180):0>h&&270==d&&(d=90);this.gradientRotation=d;0===s&&0===i&&(this.cornerRadius=u);this.draw()},draw:function(){var t=this.set;t.clear();var a=this.container,h=a.chart,s=this.w,i=this.h,e=this.dx,r=this.dy,n=this.colors,o=this.alpha,l=this.bwidth,d=this.bcolor,u=this.balpha,m=this.gradientRotation,C=this.cornerRadius,c=this.dashLength,p=this.pattern,A=this.topRadius,g=this.bcn,f=n,b=n;"object"==typeof n&&(f=n[0],b=n[n.length-1]);var M,v,y,N,L,w,x,R,T,k=o;p&&(o=0);var H,W,B,F,Y=this.rotate;if(0<Math.abs(e)||0<Math.abs(r))if(isNaN(A))x=b,b=AmCharts.adjustLuminosity(f,-.2),b=AmCharts.adjustLuminosity(f,-.2),M=AmCharts.polygon(a,[0,e,s+e,s,0],[0,r,r,0,0],b,o,1,d,0,m),0<u&&(T=AmCharts.line(a,[0,e,s+e],[0,r,r],d,u,l,c)),v=AmCharts.polygon(a,[0,0,s,s,0],[0,i,i,0,0],b,o,1,d,0,m),v.translate(e,r),0<u&&(y=AmCharts.line(a,[e,e],[r,r+i],d,u,l,c)),N=AmCharts.polygon(a,[0,0,e,e,0],[0,i,i+r,r,0],b,o,1,d,0,m),L=AmCharts.polygon(a,[s,s,s+e,s+e,s],[0,i,i+r,r,0],b,o,1,d,0,m),0<u&&(w=AmCharts.line(a,[s,s+e,s+e,s],[0,r,i+r,i],d,u,l,c)),b=AmCharts.adjustLuminosity(x,.2),x=AmCharts.polygon(a,[0,e,s+e,s,0],[i,i+r,i+r,i,i],b,o,1,d,0,m),0<u&&(R=AmCharts.line(a,[0,e,s+e],[i,i+r,i+r],d,u,l,c));else{var j,D,S;Y?(j=i/2,b=e/2,S=i/2,D=s+e/2,W=Math.abs(i/2),H=Math.abs(e/2)):(b=s/2,j=r/2,D=s/2,S=i+r/2+1,H=Math.abs(s/2),W=Math.abs(r/2));B=H*A;F=W*A;.1<H&&.1<H&&(M=AmCharts.circle(a,H,f,o,l,d,u,!1,W),M.translate(b,j));.1<B&&.1<B&&(x=AmCharts.circle(a,B,AmCharts.adjustLuminosity(f,.5),o,l,d,u,!1,F),x.translate(D,S))}o=k;1>Math.abs(i)&&(i=0);1>Math.abs(s)&&(s=0);!isNaN(A)&&(0<Math.abs(e)||0<Math.abs(r))?(n=[f],n={fill:n,stroke:d,"stroke-width":l,"stroke-opacity":u,"fill-opacity":o},Y?(o="M0,0 L"+s+","+(i/2-i/2*A),l=" B",0<s&&(l=" A"),AmCharts.VML?(o+=l+Math.round(s-B)+","+Math.round(i/2-F)+","+Math.round(s+B)+","+Math.round(i/2+F)+","+s+",0,"+s+","+i,o=o+(" L0,"+i)+(l+Math.round(-H)+","+Math.round(i/2-W)+","+Math.round(H)+","+Math.round(i/2+W)+",0,"+i+",0,0")):(o+="A"+B+","+F+",0,0,0,"+s+","+(i-i/2*(1-A))+"L0,"+i,o+="A"+H+","+W+",0,0,1,0,0"),H=90):(l=s/2-s/2*A,o="M0,0 L"+l+","+i,AmCharts.VML?(o="M0,0 L"+l+","+i,l=" B",0>i&&(l=" A"),o+=l+Math.round(s/2-B)+","+Math.round(i-F)+","+Math.round(s/2+B)+","+Math.round(i+F)+",0,"+i+","+s+","+i,o+=" L"+s+",0",o+=l+Math.round(s/2+H)+","+Math.round(W)+","+Math.round(s/2-H)+","+Math.round(-W)+","+s+",0,0,0"):(o+="A"+B+","+F+",0,0,0,"+(s-s/2*(1-A))+","+i+"L"+s+",0",o+="A"+H+","+W+",0,0,1,0,0"),H=180),a=a.path(o).attr(n),a.gradient("linearGradient",[f,AmCharts.adjustLuminosity(f,-.3),AmCharts.adjustLuminosity(f,-.3),f],H),Y?a.translate(e/2,0):a.translate(0,r/2)):a=0===i?AmCharts.line(a,[0,s],[0,0],d,u,l,c):0===s?AmCharts.line(a,[0,0],[0,i],d,u,l,c):0<C?AmCharts.rect(a,s,i,n,o,l,d,u,C,m,c):AmCharts.polygon(a,[0,0,s,s,0],[0,i,i,0,0],n,o,l,d,u,m,!1,c);s=isNaN(A)?0>i?[M,T,v,y,N,L,w,x,R,a]:[x,R,v,y,N,L,M,T,w,a]:Y?0<s?[M,a,x]:[x,a,M]:0>i?[M,a,x]:[x,a,M];AmCharts.setCN(h,a,g+"front");AmCharts.setCN(h,v,g+"back");AmCharts.setCN(h,x,g+"top");AmCharts.setCN(h,M,g+"bottom");AmCharts.setCN(h,N,g+"left");AmCharts.setCN(h,L,g+"right");for(M=0;M<s.length;M++)if(v=s[M])t.push(v),AmCharts.setCN(h,v,g+"element");p&&a.pattern(p)},width:function(t){isNaN(t)&&(t=0);this.w=Math.round(t);this.draw()},height:function(t){isNaN(t)&&(t=0);this.h=Math.round(t);this.draw()},animateHeight:function(t,a){var h=this;h.easing=a;h.totalFrames=Math.round(1e3*t/AmCharts.updateRate);h.rh=h.h;h.frame=0;h.height(1);setTimeout(function(){h.updateHeight.call(h)},AmCharts.updateRate)},updateHeight:function(){var t=this;t.frame++;var a=t.totalFrames;t.frame<=a&&(a=t.easing(0,t.frame,1,t.rh-1,a),t.height(a),setTimeout(function(){t.updateHeight.call(t)},AmCharts.updateRate))},animateWidth:function(t,a){var h=this;h.easing=a;h.totalFrames=Math.round(1e3*t/AmCharts.updateRate);h.rw=h.w;h.frame=0;h.width(1);setTimeout(function(){h.updateWidth.call(h)},AmCharts.updateRate)},updateWidth:function(){var t=this;t.frame++;var a=t.totalFrames;t.frame<=a&&(a=t.easing(0,t.frame,1,t.rw-1,a),t.width(a),setTimeout(function(){t.updateWidth.call(t)},AmCharts.updateRate))}});
//# sourceMappingURL=funnel.map.js